package com.rocksdata.mc.ui.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.ctz.commonframe.ui.widget.AbsAdapter;
import com.ctz.commonframe.ui.widget.AdapterViewHolder;
import com.rocksdata.mc.entity.NewsInfo;
import com.rocksdata.mc.R;

import java.util.List;

/**
 * Created by 陈堂正 on 2017/2/7.
 */

public class NewsListAdapter extends AbsAdapter<NewsInfo> {
    public NewsListAdapter(Context context, List<NewsInfo> datas) {
        super(context, datas, R.layout.item_news_list);
    }

    @Override
    public void convert(AdapterViewHolder holder, NewsInfo data) {
        ImageView ivImage = holder.getView(R.id.iv_news_image);
        TextView tvContent = holder.getView(R.id.tv_news_content);
        TextView tvTime = holder.getView(R.id.tv_news_time);

        ivImage.setImageResource(data.imageRes);
        tvContent.setText(data.content);
        tvTime.setText(data.time);
    }
}
